import 'package:elec_communication_protocol/elec_communication_protocol.dart';


class Interface with DeviceFoundInterface {
  @override
  void onDeviceUpdate(Device device) {
    print('update device: $device');
  }

  @override
  void onFoundDevice(Device device) {
    print('found device: $device');
  }

  @override
  void onMissDevice(Device device) {
    print('miss device: $device');
  }

  @override
  void onServiceClosed() {
  }
}


void main() async {
	final service = DeviceFoundService(Interface(), null);
	await service.start();

	Future.delayed(Duration(seconds: 2), () {
		service.tryCatchDevice(expectBoxSnMatch: (String sn) {
			return sn == '2b4f3815ba65179f';
		}, timeOut: Duration(seconds: 5)).then((value) {
			print('catch device: $value');
		});
	});
}